{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">房间管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                data-auth-add="{:$auth->check('shareroom.room/add')}" 
                data-auth-edit="{:$auth->check('shareroom.room/edit')}"
                data-auth-delete="{:$auth->check('shareroom.room/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use('yznTable', function() {
    var table = layui.yznTable;

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTable',
        add_url: '{:url("add")}',
        edit_url: '{:url("edit")}',
        delete_url: '{:url("del")}',
    };

    table.render({
        init: init,
        toolbar: ['refresh','add'],
        url: '{:url("index")}',
        cols: [
            [
                { field: 'id', width: 80, title: 'ID'},
                { field: 'room_name', width: 80, title: '房间名', searchOp: 'like' },
                { field: 'price', width: 120, title: '房间价格', search:false},
                { field: 'last_login_ip', title: '最后登录IP', searchOp: 'like'  },
                { field: 'update_time', width: 200, title: '最后登录时间', search: 'range' },
                { field: 'create_time', width: 200, title: '最后登录时间', search: 'range' },
                { field: 'nickname', title: '真实姓名', searchOp: 'like'  },
                { width:100, title: '操作',templet: function (d){
                    return yznTable.formatter.tool.call(this,d,this);
                },operat: ['edit','delete']}
            ]
        ],
        page: {}
    });

    yznTable.bindevent();
});
</script>
{/block}